package ch10_thread.thread;

/**
 * 获取当前执行线程的引用
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
public class CurrentThread implements Runnable {
    public static void main(String[] args) {
        CurrentThread syn = new CurrentThread();
        Thread t01 = new Thread(syn);
        Thread t02 = new Thread(syn);
        t01.start();
        t02.start();
        System.out.println("主线程结束");
    }

    @Override
    public void run() {
        for (int i = 0; i < 1000; i++) {
            System.out.println(Thread.currentThread().getName() + "：" + i);
        }
    }
}
